﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.Common;
using System.Data.SQLite;

namespace Report_Test
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {


            string database = @"D:\Projects\Info-2014\Test\Report_Test\Report_Test\Test.his";
            SQLiteConnection  connection = new SQLiteConnection (string.Format("Data Source={0};", database));
            connection.Open();
            SQLiteCommand command = new SQLiteCommand("SELECT * FROM history;", connection);
            SQLiteDataReader reader = command.ExecuteReader();
            string[]line_arry = new string[reader.FieldCount];
            while (reader.Read())
            {
                int a = reader.FieldCount;
                for (int i = 0; i < reader.FieldCount; i++)
                {
                    Array.Resize<string>(ref line_arry, line_arry.Length);
                    line_arry[i] = reader[i].ToString();
                    DataRow row = this.DataSet_history.DataTable1.NewRow();     
                }
                DateTime d1 = DateTime.Now; 
                this.DataSet_history.DataTable1.Rows.Add(line_arry);
            }
            this.reportViewer1.RefreshReport();
        }
    }
}
